SET user_name1=vasya
SET host1=111.111.11.11
SET port1=3306
SET db_name1=somedb_1_2

SET user_name2=root
SET host2=localhost
SET port2=3306
SET db_name2=somedb_1_2
SET dump_file1=%db_name1%_%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%_%TIME:~0,2%%TIME:~3,2%.sql
SET dump_file2=%db_name2%_%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%_%TIME:~0,2%%TIME:~3,2%.sql

@echo DUMP SCHEMA OF 1ST DB
mysqldump -u %user_name1% -p -h %host1% -P %port1% --no-data --no-create-db %db_name1% > "schema_%dump_file1%" 
@echo DUMP DATA OF 1ST DB
mysqldump -u %user_name1% -p -h %host1% -P %port1% --ignore-table=%db_name1%.log_records --no-create-db %db_name1% > "%dump_file1%" 
@echo BACK UP 2ND DB
mysqldump -u %user_name2% -p -h %host2% -P %port2% --add-drop-database %db_name2%  > "%dump_file2%.backup"

@echo RECREATE 2ND DB
mysql -u %user_name2% -p -h %host2% -P %port2% mysql -e "DROP DATABASE IF EXISTS `%db_name2%`; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `%db_name2%` /*!40100 DEFAULT CHARACTER SET utf8 */; USE `%db_name2%`;"
@echo RESTORE SCHEMA OF 2ND DB
mysql -u %user_name2% -p -h %host2% -P %port2% %db_name2% < "schema_%dump_file1%"
@echo RESTORE DATA OF 2ND DB
mysql -u %user_name2% -p -h %host2% -P %port2% %db_name2% < "%dump_file1%"

pause